import axios from "axios";
export default {
  state: {
    newbooks: []
  },
  mutations: {
    setbooks(state, newboos) {
      state.newbooks = newboos
    }
  },
  actions: {
    async Agetbooks(context) {
      let res = await axios({
        url: "https://www.fastmock.site/mock/37d3b9f13a48d528a9339fbed1b81bd5/book/api/books",
      })
      //   console.log(res);
      //   context里面有一个commit方法,
      context.commit("setbooks", res.data.data)
    }
  },
}
